<!DOCTYPE html>
<html lang="zh">
    <head>
        <meta charset="utf-8" />
        <title>Markdown to HTML</title>
        <link rel="stylesheet" href="css/style.css" />
        <link rel="stylesheet" href="css/editormd.preview.css" />
        <link rel="shortcut icon" href="https://pandao.github.io/editor.md/favicon.ico" type="image/x-icon" />
        <style> .editormd-html-preview { width: 90%; margin: 0 auto; } </style>
    </head>
    <body>
        <div id="layout">
            <!--
            <header>
                <h1>Markdown转HTML的显示处理</h1>
            </header>
            <div class="btns">
                <button onclick="location.href='examples/html-preview-markdown-to-html-custom-toc-container.html';">将 ToC 移到自定义容器层</button>
            </div>
            -->
            <div id="test-editormd-view">
               <textarea style="display:none;" name="test-editormd-markdown-doc">#Markdown转HTML的显示处理
http://md.devcp.org/preview.html?p=doc/test.md
http://md.devcp.org/preview.html?p=http://oss.devcp.org/doc/markdown/test.md
               </textarea>
            </div>
        </div>

        <script src="js/zepto.min.js"></script>
		<script>
			var jQuery = Zepto;  // 为了避免修改flowChart.js和sequence-diagram.js的源码，所以使用Zepto.js时想支持flowChart/sequenceDiagram就得加上这一句
		</script>
        <script src="http://cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script>
        <script src="http://oss.devcp.org/js/common/tool.js"></script>
        <script src="lib/marked.min.js"></script>
        <script src="lib/prettify.min.js"></script>
        <script src="lib/raphael.min.js"></script>
        <script src="lib/underscore.min.js"></script>
        <script src="lib/sequence-diagram.min.js"></script>
        <script src="lib/flowchart.min.js"></script>
        <script src="lib/jquery.flowchart.min.js"></script>
        <script src="editormd.js"></script>
        <script type="text/javascript">

            var req_url = "";
            $(function() {
                var param = getSearchParam('p');
                if(param != ''){
//                    req_url = "http://md.devcp.org/doc/"+param;
//                    req_url = "http://oss.devcp.org/markdown/test.md";
                    req_url = param;
                }else{
                    req_url = "doc/null.md";
                }

                var testEditormdView;
                $.ajax({ url: req_url
                }).fail(function(jqXHR) {
                    testEditormdView = editormd.markdownToHTML("test-editormd-view", {
                        markdown        : "#404 Not Found"
                    });
                }).done(function(markdown) {
                    testEditormdView = editormd.markdownToHTML("test-editormd-view", {
                        markdown        : markdown ,//+ "\r\n" + $("#append-test").text(),
                        //htmlDecode      : true,       // 开启 HTML 标签解析，为了安全性，默认不开启
                        htmlDecode      : "style,script,iframe",  // you can filter tags decode
                        tocm            : true,    // Using [TOCM]
                        emoji           : true,
                        taskList        : true,
                        tex             : true,  // 默认不解析
                        flowChart       : true,  // 默认不解析
                        sequenceDiagram : true,  // 默认不解析
                    });
                });

            });
        </script>
    </body>
</html>